home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / math / aprs790.zip / MOTOROLA.BAS < prev    next >
BASIC Source File  |  1996-03-28  |  4KB  |  108 lines

  1. CLS
  2. PRINT "This program allows you to send control codes to the MOTOROLA GPS receivers."
  3. PRINT
  4. PRINT "You could do this with a dumb terminal, but you would need to enter the "
  5. PRINT "exact checksum characters before the GPS receiver will recognize the"
  6. PRINT "command.  This program computes the checksum characters and automatically"
  7. PRINT "inserts them on the end.."
  8. PRINT
  9. PRINT
  10. PRINT
  11. INPUT "To which COM port is your GPS connected (1/2)"; P$
  12. IF P$ = "" THEN P$ = "1": hspp = 1024 ELSE P$ = "2": hspp = 764
  13. PRINT
  14. PRINT
  15. INPUT "If you need to Toggle the APRS HSP, hit H, otherwise ENTER"; a$
  16. IF a$ <> "" THEN OUT hspp, INP(hspp) AND 254
  17.  
  18. CLS
  19. PRINT
  20. PRINT "PREPARING TO SEND THE BINARY COMMAND TO SHIFT THE GPS FROM BINARY TO NMEA"
  21. PRINT
  22. PRINT "If the receiver is in an unknown status, or known to be in the Motorola"
  23. PRINT "Binary mode, then you need to send this command.  It should be sent at the"
  24. PRINT "default Binary speed of 9600 baud.  This program will use 9600 baud..."
  25. PRINT
  26. PRINT
  27. PRINT " MODE COMMAND:       @@Ci^a+CRLF"
  28. PRINT " where                ||| || | *- LINE FEED CHARACTER"
  29. PRINT "                      ||| || *--- Carriage Return character"
  30. PRINT "                      ||| |*----- Check sum (+) for this exact string"
  31. PRINT "                      ||| *------ Control A (sent as a single 8 bit char)"
  32. PRINT "                      ||*-------- lower case i"
  33. PRINT "                      |*--------- capital C"
  34. PRINT "                      *---------- @@ characters"
  35. PRINT
  36. INPUT "Proceed to place the receiver in to NMEA mode (y/n) (N)"; a$
  37. IF UCASE$(a$) = "Y" THEN
  38.    PRINT
  39.    PRINT "Sending NMEA mode command at 9600 baud..."
  40.    OPEN "COM" + P$ + ":9600,N,8,1,CS0,CD0,DS0" FOR RANDOM AS #1
  41.    PRINT #1,
  42.    PRINT #1, "@@Ci"; CHR$(1); "+"; CHR$(13); CHR$(10);
  43.    CLOSE #1
  44. END IF
  45.  
  46.  
  47. CLS
  48. PRINT "Now re-opening the COM port at the default NMEA 4800 baud rate..."
  49. PRINT
  50.  
  51. OPEN "COM" + P$ + ":4800,N,8,1,CS0,CD0,DS0" FOR RANDOM AS #1
  52. PRINT "DONE!"
  53. PRINT
  54. PRINT
  55.  
  56. Again:
  57.  
  58. PRINT "Now send a Motorola command to enable any selected NMEA string in the"
  59. PRINT "following list.  The RAW format for the command is as follows:"
  60. PRINT
  61. PRINT "     $PMOTG,GGA,xxxx*ccCRLF   Where cc is the XOR checksum of all"
  62. PRINT "                              characters between the $ and the *."
  63. PRINT "                              then end the line with CR/LF.  The"
  64. PRINT "                              xxxx (4 digits) is the periodicity"
  65. PRINT "                              of that NMEA command in seconds."
  66. PRINT
  67. PRINT "Other NMEA sentences are:     GGA,GLL,RMC,GSA,GSV,VTG,ZDA"
  68. PRINT ""
  69. PRINT "To return to BINARY, send the NMEA command: $PMOTG,FOR,0*ccCRLF"
  70. PRINT ""
  71. PRINT "To send the command, type all characters between the $PMOTG,... and *."
  72. PRINT "To view the receiver output, type VIEW."
  73. PRINT "To end this program, type END."
  74. PRINT ""
  75.  
  76. DO
  77.  
  78.    LINE INPUT "Enter the command string (or VIEW or END) > "; S$
  79.    S$ = UCASE$(S$): IF S$ = "END" THEN STOP
  80.    IF S$ = "VIEW" THEN EXIT DO
  81.    IF RIGHT$(S$, 1) = "*" THEN S$ = LEFT$(S$, LEN(S$) - 1)
  82.    S$ = "PMOTG," + S$
  83.    cs = 0
  84.    FOR i = 1 TO LEN(S$)
  85.        cs = cs XOR ASC(MID$(S$, i, 1))
  86.    NEXT i
  87.    Cmd$ = "$" + S$ + "*" + RIGHT$("0" + HEX$(cs), 2)
  88.    PRINT Cmd$: PRINT #1, Cmd$; CHR$(13); CHR$(10);
  89. LOOP
  90.  
  91. CLS
  92. LOCATE 25, 1: PRINT "Hit ESC to return to menu...";
  93. LOCATE 1, 1
  94.  
  95.  
  96. DO
  97. a$ = INPUT$(LOC(1), 1)
  98. REM If you get an error here, then your GPS is still outputting BINARY and
  99. REM never got set to NMEA.  Restart the program and be sure to indicate the
  100. REM correct COM port and to answer (Y)es to SEND THE NMEA MODE COMMAND.
  101. PRINT a$;
  102. IF INKEY$ = CHR$(27) THEN EXIT DO
  103. LOOP
  104. CLS
  105. GOTO Again
  106. END
  107.  
  108.